package com.company.finance.ddd.domain.core.bill.repository;

import com.company.finance.ddd.common.IRepository;
import com.company.finance.ddd.domain.core.bill.aggregate.FingertipItem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @author wanglei
 */
@Repository
public class FingertipItemRepository implements IRepository<FingertipItem> {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Override
    public void save(FingertipItem entity) {

    }

    @Override
    public List<FingertipItem> query(Map<String, Object> queryCondition) {
        return jdbcTemplate.query("select * from bill_item_fingertip where bill_id = ?"
                , queryCondition.values().toArray(), new BeanPropertyRowMapper<>(FingertipItem.class));
    }

    @Override
    public FingertipItem get(Long id) {
        return null;
    }

    @Override
    public void delete(Long billId) {
        throw new UnsupportedOperationException();
    }
}
